import dicts from './dict.json'

let mocks: MockRecord[] = [
  {
    method: "get",
    url: '/api/system/dict/type/optionselect',
    response() {
      let resDict = JSON.parse(JSON.stringify(dicts));
      resDict.forEach(item => {
        delete item.children;
      })
      let resData: responseType = {
        code: 200,
        data: resDict,
        msg: "",
      }
      return resData;
    }
  },
  {
    method: "get",
    url: '/api/system/dict/data/type/:dictType',
    response(response) {
      let dictItem = dicts.find(item => item.dictType == response.query.dictType);
      let resData: responseType = {
        code: 200,
        data: dictItem?.children || [],
        msg: "",
      }
      return resData;
    }
  }
]

export default mocks